<?php

class grandpanda_scraper extends BlogScraper
{
    function __construct()
    {
        parent::__construct('grandpanda');
    }

    function getPostLinks()
    {
        return $this->xpath->query("//html//body//a[@class='post-footer-link']");   
        
    }
}


class grandpanda_post_scraper extends PostScraper
{
    function getPosts()
    {
        return $this->xpath->query("//html//body//div[@class='post']");   
        
    }
    
    function getText($post)
    {
        $text = $this->xpath->query("//html//body//div[@class='post-body']")->item(0)->nodeValue;    

        return $text;
    }
    
    function getTitle($post)
    {
        $url = $this->url;
        $parts = explode('/', $url);
        $title = $parts[count($parts)-1];
        $title = str_replace('.html', '', $title);
        $title = str_replace('-', ' ', $title);

        return $title;
    }
    
    function getLink($post)
    {
        return $this->url;
    }
        
    function getDate($post)
    {
        $date = $this->xpath->query("//html//body//h2[@class='date-header']")->item(0)->nodeValue;
        $time = $this->xpath->query("//html//body//a[@class='post-footer-link']")->item(0)->nodeValue;
        echo $date.' '.$time;
        return date('Y-m-d H:i:s', strtotime($date.' '.$time));

    }
    
    
}

?>